<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>mp3in</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="moscil.html" title="moscil" />
    <link rel="next" href="mp3len.html" title="mp3len" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">mp3in</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="moscil.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="mp3len.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="mp3in"></a>
      <div class="titlepage"></div>
      <a id="IndexMp3in" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">mp3in</span>
        </h2>
        <p>mp3in — 
      Reads mono or stereo audio data from an external MP3 file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp126642752"></a>
        <h2>Description</h2>
        <p>
      Reads mono or stereo audio data from an external MP3 file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp126643904"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ar1, ar2 <span class="command"><strong>mp3in</strong></span> ifilcod[, iskptim, iformat, iskipinit, ibufsize]</pre>
        <pre class="synopsis">ar1 <span class="command"><strong>mp3in</strong></span> ifilcod[, iskptim, iformat, iskipinit, ibufsize]</pre>
      </div>
      <div class="refsect1">
        <a id="idp126647456"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifilcod</em></span> -- integer or character-string
      denoting the source soundfile name. An integer denotes the file
      soundin.filcod ; a character-string (in double quotes, spaces
      permitted) gives the filename itself, optionally a full
      pathname. If not a full path, the named file is sought first in
      the current directory, then in that given by the environment
      variable <a class="link" href="CommandEnvironment.html" title="Csound Environment Variables"><em class="citetitle">SSDIR</em></a> (if defined) then by <a class="link" href="CommandEnvironment.html" title="Csound Environment Variables"><em class="citetitle">SFDIR</em></a>.
    </p>
        <p>
      <span class="emphasis"><em>iskptim</em></span> (optional) -- time in seconds of input sound to be skipped. The default value is 0.
    </p>
        <p>
      <span class="emphasis"><em>iformat</em></span> (optional) -- specifies the audio
      data file format:  currently not implemented and always defaults
      to stereo.
    </p>
        <p>
     <span class="emphasis"><em>iskipinit</em></span> (optional) -- switches off all 
     initialisation if non zero (default =0).
    </p>
        <p>
     <span class="emphasis"><em>ibuffersize</em></span> (optional) -- sets the internal buffer size
     for reading.  If the value is omitted, zero or negative it defaults to
     4096 bytes.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp126655088"></a>
        <h2>Performance</h2>
        <p>
      Reads audio data from an external MP3 file. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp126656352"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the mp3in opcode. It uses the file <a class="ulink" href="examples/mp3in.csd" target="_top"><em class="citetitle">mp3in.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp126658208"></a>
          <p class="title">
            <strong>Example 529. Example of the mp3in opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac    <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o mp3in.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

iskptim	 <span class="op">=</span> .3
ibufsize <span class="op">=</span> 64
ar1, ar2 <span class="opc">mp3in</span> "beats.mp3", iskptim, 0, 0, ibufsize
         <span class="opc">outs</span> ar1, ar2

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 2
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp126662496"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="diskin.html" title="diskin"><em class="citetitle">diskin</em></a>,
      <a class="link" href="ins.html" title="ins"><em class="citetitle">ins</em></a>,
      <a class="link" href="in.html" title="in"><em class="citetitle">in</em></a>,
      <a class="link" href="inch.html" title="inch"><em class="citetitle">inh</em></a>,
      <a class="link" href="inh.html" title="inh"><em class="citetitle">inh</em></a>,
      <a class="link" href="ino.html" title="ino"><em class="citetitle">ino</em></a>,
      <a class="link" href="inq.html" title="inq"><em class="citetitle">inq</em></a>,
      <a class="link" href="mp3len.html" title="mp3len"><em class="citetitle">mp3len</em></a>,
      <a class="link" href="soundin.html" title="soundin"><em class="citetitle">soundin</em></a>
     </p>
      </div>
      <div class="refsect1">
        <a id="idp126671872"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>Codemist Ltd</td>
          </tr>
          <tr>
            <td>2009</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.11</p>
        <p>Mono added in 6.05</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="moscil.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="mp3len.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">moscil </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> mp3len</td>
        </tr>
      </table>
    </div>
  </body>
</html>
